﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:System="clr-namespace:System;assembly=mscorlib"
                    xmlns:Layout="clr-namespace:GraphSharp.Algorithms.Layout;assembly=GraphSharp"
                    xmlns:SimpleFDPLayout="clr-namespace:GraphSharp.Algorithms.Layout.Simple.FDP;assembly=GraphSharp"
                    xmlns:SimpleHierarchicalLayout="clr-namespace:GraphSharp.Algorithms.Layout.Simple.Hierarchical;assembly=GraphSharp"
                    xmlns:SimpleTreeLayout="clr-namespace:GraphSharp.Algorithms.Layout.Simple.Tree;assembly=GraphSharp"
                    xmlns:OverlapRemoval="clr-namespace:GraphSharp.Algorithms.OverlapRemoval;assembly=GraphSharp"
                    xmlns:loc="clr-namespace:Tomers.WPF.Localization;assembly=Tomers.WPF.Localization">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../Styles/UIDefaults.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <ObjectDataProvider MethodName="GetValues"
                        ObjectType="{x:Type System:Enum}"
                        x:Key="layoutDirectionEnum">
        <ObjectDataProvider.MethodParameters>
            <x:Type TypeName="Layout:LayoutDirection" />
        </ObjectDataProvider.MethodParameters>
    </ObjectDataProvider>

    <ObjectDataProvider MethodName="GetValues"
                        ObjectType="{x:Type System:Enum}"
                        x:Key="treeGenerationTypeEnum">
        <ObjectDataProvider.MethodParameters>
            <x:Type TypeName="SimpleTreeLayout:SpanningTreeGeneration" />
        </ObjectDataProvider.MethodParameters>
    </ObjectDataProvider>

    <ObjectDataProvider MethodName="GetValues"
                        ObjectType="{x:Type System:Enum}"
                        x:Key="sugiyamaEdgeRoutingEnum">
        <ObjectDataProvider.MethodParameters>
            <x:Type TypeName="SimpleHierarchicalLayout:SugiyamaEdgeRoutings" />
        </ObjectDataProvider.MethodParameters>
    </ObjectDataProvider>

    <!-- Fruchterman-Reingold datatemplate -->
    <DataTemplate DataType="{x:Type SimpleFDPLayout:BoundedFRLayoutParameters}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <TextBlock Grid.Column="0"
                       Grid.Row="0"><Run Text="Width" /></TextBlock>
            <StackPanel Grid.Column="1"
                        Orientation="Horizontal">
                <Slider Minimum="0"
                        Maximum="1000"
                        Value="{Binding Path=Width}"
                        Width="100.000333333333"
                        Height="22"
                        x:Name="slider" />
                <TextBlock Text="{Binding Path=Value, ElementName=slider, Mode=Default}"
                           TextWrapping="Wrap" />
            </StackPanel>

            <TextBlock Grid.Column="0"
                       Grid.Row="1"><Run Text="Height" /></TextBlock>
            <StackPanel Orientation="Horizontal"
                        Grid.Row="1"
                        Grid.Column="1">
                <Slider Minimum="0"
                        Maximum="1000"
                        Value="{Binding Path=Height}"
                        MinWidth="100"
                        x:Name="slider1" />
                <TextBlock Text="{Binding Path=Value, ElementName=slider1, Mode=Default}"
                           TextWrapping="Wrap" />
            </StackPanel>

            <TextBlock Grid.Column="0"
                       Grid.Row="2"><Run Text="K" /></TextBlock>
            <TextBlock Text="{Binding Path=K}"
                       Grid.Column="1"
                       Grid.Row="2" />

            <TextBlock Grid.Column="0"
                       Grid.Row="3"><Run Text="AttractionMultiplier" /></TextBlock>
            <StackPanel Margin="0,0,20.853,3.96"
                        Grid.RowSpan="1"
                        Grid.Row="3"
                        Grid.Column="1"
                        Orientation="Horizontal">
                <Slider Minimum="0"
                        Maximum="5"
                        Value="{Binding Path=AttractionMultiplier}"
                        Width="100.000333333333"
                        Height="22"
                        x:Name="slider2" />
                <TextBlock Text="{Binding Path=Value, ElementName=slider2, Mode=Default}"
                           TextWrapping="Wrap"
                           VerticalAlignment="Center" />
            </StackPanel>

            <TextBlock Grid.Column="0"
                       Grid.Row="4"><Run Text="RepulsiveMultiplier" /></TextBlock>
            <StackPanel Grid.Column="1"
                        Grid.Row="4"
                        Orientation="Horizontal">
                <Slider Minimum="0"
                        Maximum="5"
                        Value="{Binding Path=RepulsiveMultiplier}"
                        Width="100.000333333333"
                        Height="22"
                        x:Name="slider3" />
                <TextBlock Text="{Binding Path=Value, ElementName=slider3, Mode=Default}"
                           TextWrapping="Wrap" />
            </StackPanel>

            <TextBlock Grid.Column="0"
                       Grid.Row="5"><Run Text="IterationCount" /></TextBlock>
            <TextBlock Text="{Binding Path=IterationCount}"
                       Grid.Column="1"
                       Grid.Row="5" />
        </Grid>
    </DataTemplate>

    <!-- ComplexHierarchical DataTemplate -->
    <DataTemplate DataType="{x:Type SimpleHierarchicalLayout:SugiyamaLayoutParameters}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="5" />
                <ColumnDefinition />

                <ColumnDefinition />
                <ColumnDefinition Width="5" />
                <ColumnDefinition />

                <ColumnDefinition />
                <ColumnDefinition Width="5" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <TextBlock Grid.Column="0"
                       Grid.Row="0"><Run Text="Dirty Round" /></TextBlock>
            <CheckBox IsChecked="{Binding Path=DirtyRound}"
                      Grid.Column="2"
                      Grid.Row="0" />

            <TextBlock Grid.Column="0"
                       Grid.Row="1"><Run Text="Horizontal Gap" /></TextBlock>
            <TextBox Text="{Binding Path=HorizontalGap, UpdateSourceTrigger=PropertyChanged}"
                     Grid.Column="2"
                     Grid.Row="1" />

            <TextBlock Grid.Column="0"
                       Grid.Row="2"><Run Text="Vertical Gap" /></TextBlock>
            <TextBox Text="{Binding Path=VerticalGap, UpdateSourceTrigger=PropertyChanged}"
                     Grid.Column="2"
                     Grid.Row="2" />

            <!--  -->

            <TextBlock Grid.Column="4"
                       Grid.Row="0"><Run Text="Phase1 Iteration Count" /></TextBlock>
            <TextBox Text="{Binding Path=Phase1IterationCount, UpdateSourceTrigger=PropertyChanged}"
                     Grid.Column="6"
                     Grid.Row="0" />

            <TextBlock Grid.Column="4"
                       Grid.Row="1"><Run Text="Phase2 Iteration Count" /></TextBlock>
            <TextBox Text="{Binding Path=Phase2IterationCount, UpdateSourceTrigger=PropertyChanged}"
                     Grid.Column="6"
                     Grid.Row="1" />

            <TextBlock Grid.Column="4"
                       Grid.Row="2"><Run Text="Minimize Hierarchical EdgeLong" /></TextBlock>
            <CheckBox IsChecked="{Binding Path=MinimizeHierarchicalEdgeLong}"
                      Grid.Column="6"
                      Grid.Row="2" />

            <TextBlock Grid.Column="8"
                       Grid.Row="0"><Run Text="Position Calculation Method" /></TextBlock>
            <!--<ComboBox ItemsSource="{Binding Source={StaticResource posCalcMethodEnum}}" SelectedValue="{Binding Path=PositionCalculationMethod}" Grid.Column="1" Grid.Row="6"/>-->
        </Grid>
    </DataTemplate>

    <Style x:Key="SeparatorStyle"
           TargetType="{x:Type Border}">
        <Setter Property="BorderThickness" Value="1,0,0,0"/>
        <Setter Property="BorderBrush" Value="#FFC5C5C5"/>
        <!--<Setter Property="Margin" Value="10,0,10,0"/>-->
        <Setter Property="Width" Value="2"/>
        <Setter Property="Background" Value="White"/>
    </Style>

    <Style x:Key="HorizontalSeparatorStyle"
           TargetType="{x:Type Border}">
        <Setter Property="BorderThickness" Value="0,1,0,0"/>
        <Setter Property="BorderBrush" Value="#FFC5C5C5"/>
        <!--<Setter Property="Margin" Value="10,0,10,0"/>-->
        <Setter Property="Height" Value="2"/>
        <Setter Property="Background" Value="White"/>
    </Style>
    
    <!-- ComplexHierarchical DataTemplate -->
    <DataTemplate DataType="{x:Type SimpleHierarchicalLayout:EfficientSugiyamaLayoutParameters}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="5" />
                <ColumnDefinition Width="Auto"/>

                <ColumnDefinition Width="10" />

                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="5" />
                <ColumnDefinition Width="Auto"/>

                <ColumnDefinition Width="10" />

                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="5" />
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="2" />
                <RowDefinition />
            </Grid.RowDefinitions>

            <TextBlock Grid.Column="0" Grid.Row="0" loc:Translate.Uid="Sugiyama.LayerGap" Text="{loc:Translate 'Layer gap'}" Height="{StaticResource TextBlockHeight}" />
            <TextBox Text="{Binding Path=LayerDistance, UpdateSourceTrigger=PropertyChanged}"
                     Grid.Column="2" Width="25" Margin="{StaticResource TextBoxMargin}"
                     Grid.Row="0" />

            <TextBlock Grid.Column="0" Grid.Row="2" loc:Translate.Uid="Sugiyama.VertexGap" Text="{loc:Translate 'Vertex gap'}" Height="{StaticResource TextBlockHeight}" />
            <TextBox Text="{Binding Path=VertexDistance, UpdateSourceTrigger=PropertyChanged}"
                     Grid.Column="2" Width="25" Margin="{StaticResource TextBoxMargin}"
                     Grid.Row="2" />

            <Border Style="{StaticResource SeparatorStyle}" Grid.Column="3" Grid.RowSpan="3" />
            <!-- -->

            <TextBlock Grid.Column="4" Grid.Row="0" loc:Translate.Uid="Sugiyama.PositionMode" Text="{loc:Translate 'Position Mode'}" Height="{StaticResource TextBlockHeight}" />
            <TextBox Text="{Binding Path=PositionMode, UpdateSourceTrigger=PropertyChanged}"
                     Grid.Column="6" Width="25" Margin="{StaticResource TextBoxMargin}"
                     Grid.Row="0" />

            <TextBlock Grid.Column="4" Grid.Row="2" loc:Translate.Uid="Sugiyama.MinimizeEdgeLength" Text="{loc:Translate 'Minimize Edge Length'}" Height="{StaticResource TextBlockHeight}" />
            <CheckBox IsChecked="{Binding Path=MinimizeEdgeLength, UpdateSourceTrigger=PropertyChanged}"
                      Content="{Binding Path=MinimizeEdgeLength, UpdateSourceTrigger=PropertyChanged}"
                      Grid.Column="6" Margin="{StaticResource TextBoxMargin}"
                      Grid.Row="2" />

            <Border Style="{StaticResource SeparatorStyle}" Grid.Column="7" Grid.RowSpan="3" />
            <!-- -->

            <TextBlock Grid.Column="8" Grid.Row="0" loc:Translate.Uid="Sugiyama.EdgeRouting" Text="{loc:Translate 'Edge routing'}" Height="{StaticResource TextBlockHeight}" />
            <ComboBox ItemsSource="{Binding Source={StaticResource sugiyamaEdgeRoutingEnum}}"
                      SelectedValue="{Binding Path=EdgeRouting}"
                      Margin="{StaticResource ComboBoxMargin}"
                      Grid.Column="10"
                      Grid.Row="0" />

            <TextBlock Grid.Column="8" Grid.Row="2" loc:Translate.Uid="Sugiyama.OptimizeWidth" Text="{loc:Translate 'Optimize Width'}" Height="{StaticResource TextBlockHeight}" />
            <CheckBox IsChecked="{Binding Path=OptimizeWidth, UpdateSourceTrigger=PropertyChanged}"
                      Content="{Binding Path=OptimizeWidth, UpdateSourceTrigger=PropertyChanged}"
                      Margin="{StaticResource TextBoxMargin}"
                      Grid.Column="10"
                      Grid.Row="2" />
        </Grid>
    </DataTemplate>

    <!-- Meyer's ISOMLayout -->
    <DataTemplate DataType="{x:Type SimpleFDPLayout:ISOMLayoutParameters}">
        <StackPanel>
            <Grid  Width="Auto"
                   Height="Auto">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="5" />
                    <ColumnDefinition />

                    <ColumnDefinition Width="5" />

                    <ColumnDefinition />
                    <ColumnDefinition Width="5" />
                    <ColumnDefinition />

                    <ColumnDefinition Width="5" />

                    <ColumnDefinition />
                    <ColumnDefinition Width="5" />
                    <ColumnDefinition />

                    <ColumnDefinition Width="5" />

                    <ColumnDefinition />
                    <ColumnDefinition Width="5" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>

                <TextBlock Grid.Column="0" Grid.Row="0"><Run Text="Width" /></TextBlock>
                <StackPanel Orientation="Horizontal"
                            Grid.Column="2"
                            Grid.Row="0">
                    <Slider Minimum="0"
                            Maximum="1000"
                            Value="{Binding Path=Width}"
                            MinWidth="100" />
                    <TextBox />
                </StackPanel>

                <TextBlock Grid.Column="0"
                           Grid.Row="1"><Run Text="Height" /></TextBlock>
                <Slider Minimum="0"
                        Maximum="1000"
                        Value="{Binding Path=Height}"
                        Grid.Column="2"
                        Grid.Row="1" />

                <TextBlock Grid.Column="0"
                           Grid.Row="2"><Run Text="MaxEpoch" /></TextBlock>
                <TextBox Text="{Binding Path=MaxEpoch}"
                         Grid.Column="2"
                         Grid.Row="2" />

                <!-- -->

                <TextBlock Grid.Column="4"
                           Grid.Row="0"><Run Text="RadiusConstantTime" /></TextBlock>
                <Slider Minimum="0"
                        Maximum="5"
                        Value="{Binding Path=RadiusConstantTime}"
                        Grid.Column="6"
                        Grid.Row="0" />

                <TextBlock Grid.Column="4"
                           Grid.Row="1"><Run Text="Radius" /></TextBlock>
                <Slider Minimum="0"
                        Maximum="5"
                        Value="{Binding Path=Radius}"
                        Grid.Column="6"
                        Grid.Row="1" />

                <TextBlock Grid.Column="6"
                           Grid.Row="2"><Run Text="MinRadius" /></TextBlock>
                <TextBox Text="{Binding Path=MinRadius}"
                         Grid.Column="6"
                         Grid.Row="2" />

                <!-- -->

                <TextBlock Grid.Column="8"
                           Grid.Row="0"><Run Text="Adaption" /></TextBlock>
                <TextBox Text="{Binding Path=Adaption}"
                         Grid.Column="10"
                         Grid.Row="0" />

                <TextBlock Grid.Column="8"
                           Grid.Row="1"><Run Text="InitialAdaption" /></TextBlock>
                <TextBox Text="{Binding Path=InitialAdaption}"
                         Grid.Column="10"
                         Grid.Row="1" />

                <TextBlock Grid.Column="8"
                           Grid.Row="2"><Run Text="MinAdaption" /></TextBlock>
                <TextBox Text="{Binding Path=MinAdaption}"
                         Grid.Column="10"
                         Grid.Row="2" />

                <!-- -->

                <TextBlock Grid.Column="12"
                           Grid.Row="0"><Run Text="CoolingFactor" /></TextBlock>
                <TextBox Text="{Binding Path=CoolingFactor}"
                         Grid.Column="14"
                         Grid.Row="0" />
            </Grid>
        </StackPanel>
    </DataTemplate>

    <!--LinLog Parameters-->
    <DataTemplate DataType="{x:Type SimpleFDPLayout:LinLogLayoutParameters}">
        <Grid  Width="Auto"
               Height="Auto">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <TextBlock Grid.Column="0"
                       Grid.Row="0">AttractionExponent</TextBlock>
            <StackPanel Orientation="Horizontal"
                        Grid.Column="1"
                        Grid.Row="0">
                <Slider Minimum="0"
                        Maximum="5"
                        Value="{Binding Path=AttractionExponent}"
                        MinWidth="100" />
                <TextBox Text="{Binding Path=AttractionExponent}" />
            </StackPanel>

            <TextBlock Grid.Column="0"
                       Grid.Row="1">RepulsiveExponent</TextBlock>
            <StackPanel Orientation="Horizontal"
                        Grid.Column="1"
                        Grid.Row="1">
                <Slider Minimum="0"
                        Maximum="5"
                        Value="{Binding Path=RepulsiveExponent}"
                        MinWidth="100" />
                <TextBox Text="{Binding Path=RepulsiveExponent}" />
            </StackPanel>

            <TextBlock Grid.Column="0"
                       Grid.Row="2">GravitationMultiplier</TextBlock>
            <StackPanel Orientation="Horizontal"
                        Grid.Column="1"
                        Grid.Row="2">
                <Slider Minimum="0"
                        Maximum="5"
                        Value="{Binding Path=GravitationMultiplier}"
                        MinWidth="100" />
                <TextBox Text="{Binding Path=GravitationMultiplier}" />
            </StackPanel>

            <TextBlock Grid.Column="0"
                       Grid.Row="3">IterationCount</TextBlock>
            <Slider Minimum="0"
                    Maximum="1000"
                    Value="{Binding Path=IterationCount}"
                    Grid.Column="1"
                    Grid.Row="3" />
        </Grid>
    </DataTemplate>

    <!--OverlapRemovalParameters-->
    <DataTemplate DataType="{x:Type OverlapRemoval:OverlapRemovalParameters}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <TextBlock Grid.Column="0" Grid.Row="0" loc:Translate.Uid="OverlapRemoval.HorizontalGap" Text="{loc:Translate 'Horizontal gap'}" />
            <StackPanel Orientation="Horizontal"
                        Grid.Column="1"
                        Grid.Row="0">
                <Slider Minimum="0"
                        Maximum="50"
                        TickFrequency="0.01"
                        IsSnapToTickEnabled="True"
                        Value="{Binding Path=HorizontalGap}"
                        MinWidth="100" />
                <TextBox Text="{Binding Path=HorizontalGap}" Width="50" Margin="{StaticResource TextBoxMargin}" />
            </StackPanel>

            <TextBlock Grid.Column="0" Grid.Row="1" loc:Translate.Uid="OverlapRemoval.VerticalGap" Text="{loc:Translate 'Vertical gap'}" />
            <StackPanel Orientation="Horizontal"
                        Grid.Column="1"
                        Grid.Row="1">
                <Slider Minimum="0"
                        Maximum="50"
                        TickFrequency="0.01"
                        IsSnapToTickEnabled="True"
                        Value="{Binding Path=VerticalGap}"
                        MinWidth="100" />
                <TextBox Text="{Binding Path=VerticalGap}" Width="50" Margin="{StaticResource TextBoxMargin}" />
            </StackPanel>
        </Grid>
    </DataTemplate>

    <!--SimpleTreeLayoutParameters-->
    <DataTemplate DataType="{x:Type SimpleTreeLayout:SimpleTreeLayoutParameters}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                
                <ColumnDefinition Width="5" />

                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <TextBlock Grid.Column="0" Grid.Row="0" loc:Translate.Uid="SimpleTreeLayout.LayerGap" Text="{loc:Translate 'Layer Gap'}" 
                       Height="{StaticResource TextBlockHeight}" />
            <StackPanel Orientation="Horizontal"
                        Grid.Column="1"
                        Grid.Row="0">
                <Slider Minimum="0"
                        Maximum="50"
                        Value="{Binding Path=LayerGap}"
                        TickFrequency="0.01"
                        IsSnapToTickEnabled="True"
                        MinWidth="100" />
                <TextBox Text="{Binding Path=LayerGap}" Margin="{StaticResource TextBoxMargin}" Width="50" MaxWidth="80" />
            </StackPanel>

            <TextBlock Grid.Column="0" Grid.Row="1" loc:Translate.Uid="SimpleTreeLayout.VerticalGap" Text="{loc:Translate 'Vertical Gap'}" 
                       Height="{StaticResource TextBlockHeight}" />
            <StackPanel Orientation="Horizontal"
                        Grid.Column="1"
                        Grid.Row="1">
                <Slider Minimum="0"
                        Maximum="50"
                        Value="{Binding Path=VertexGap}"
                        TickFrequency="0.01"
                        IsSnapToTickEnabled="True"
                        MinWidth="100" />
                <TextBox Text="{Binding Path=VertexGap}" Margin="{StaticResource TextBoxMargin}" Width="50" MaxWidth="80" />
            </StackPanel>

            <Border Style="{StaticResource SeparatorStyle}" Grid.Column="2" Grid.RowSpan="2" />

            <TextBlock Grid.Column="3" Grid.Row="0" loc:Translate.Uid="SimpleTreeLayout.LayoutDirection" Text="{loc:Translate 'Layout direction'}"
                       Height="{StaticResource TextBlockHeight}" />
            <ComboBox ItemsSource="{Binding Source={StaticResource layoutDirectionEnum}}"
                      Margin="{StaticResource ComboBoxMargin}"
                      SelectedValue="{Binding Path=Direction}"
                      Grid.Column="4"
                      Grid.Row="0" />

            <TextBlock Grid.Column="3" Grid.Row="1" loc:Translate.Uid="SimpleTreeLayout.TreeGeneration" Text="{loc:Translate 'Tree generation'}" />
            <ComboBox ItemsSource="{Binding Source={StaticResource treeGenerationTypeEnum}}"
                      SelectedValue="{Binding Path=SpanningTreeGeneration}"
                      Margin="{StaticResource ComboBoxMargin}"
                      Grid.Column="4"
                      Grid.Row="1" />
        </Grid>
    </DataTemplate>

</ResourceDictionary>